#include <test_schwarz.hpp>
#include <iostream>

namespace Life {

template<int Dim, int Order, template<uint16_type,uint16_type,uint16_type> class Entity>
void //typename Test_Schwarz<Dim, Order, Entity>::mesh_ptrtype
Test_Schwarz<Dim, Order, Entity>::ola( double meshSize )
{
    mesh_ptrtype mesh( new mesh_type );

    //    return mesh;
}



template<int Dim, int Order, template<uint16_type,uint16_type,uint16_type> class Entity>
void
Test_Schwarz<Dim, Order, Entity>::run()
{   
    using namespace Life::vf;

    //----------------------------------------------------------------------------------------------------------//
    
    if ( this->vm().count( "help" ) )
        {
            std::cout << this->optionsDescription() << "\n";
            return;
        }

    //----------------------------------------------------------------------------------------------------------//
    
    // First we create the mesh
    //mesh_ptrtype mesh = createMesh( meshSize );
    //mesh_ptrtype mesh1 = createSubMesh(mesh,mesh->markerName("Physique1"));
    //mesh_ptrtype mesh2 = createSubMesh(mesh,mesh->markerName("Physique2"));

    //    mesh_ptrtype mesh = createMesh1( meshSize );
    /*    mesh_ptrtype mesh1 = createMesh1( meshSize );
    mesh_ptrtype mesh2 = createMesh2( meshSize );

    //----------------------------------------------------------------------------------------------------------//

    //The function space and some associate elements are then defined
    space_ptrtype Xh = space_type::New( mesh1 );

    space_ptrtype Xh1 = space_type::New( mesh1 );
    space_ptrtype Xh2 = space_type::New( mesh2 );

    //----------------------------------------------------------------------------------------------------------//

    //mono domain
    element_type U( Xh, "u" );
    element_type V( Xh, "v" );

    //multi-domain
    element_type U1( Xh1, "u1" );element_type U1b( Xh1, "u1b" );element_type U1ex( Xh1, "u1ex" );
    element_type V1( Xh1, "v1" );
    element_type U2( Xh2, "u2" );element_type U2b( Xh2, "u2b" );element_type U2ex( Xh2, "u2ex" );
    element_type V2( Xh2, "v2" );


    //----------------------------------------------------------------------------------------------------------//

    AUTO( SolAnalytique, cos(M_PI*Px()/2.0)*cos(M_PI*Py()/2.0) );
    //U = project( Xh, elements(Xh->mesh()), SolAnalytique );
    U1ex = project( Xh1, elements(Xh1->mesh()), SolAnalytique );
    U2ex = project( Xh2, elements(Xh2->mesh()), SolAnalytique );

    vector_ptrtype R( M_backend->newVector( Xh ) );
    sparse_matrix_ptrtype J( M_backend->newMatrix(Xh,Xh) );
    this->problem(U,V,J,R);

    exportResults( U, U, U);
    */
}


} // Life

// instantiation
template class Life::Test_Schwarz<2,2,Life::Simplex>;
